-- magic_affinity
-- created by zhuangsl
-- 元素亲和状态

return {
    fetchProps = function(who, status, condition)
        local props    = {};
        local endRound = condition["end_round"];

        -- 魔力提升
        local propId = PropM.getPropId("attrib3");
        local value  = condition["magic"];
        table.insert(props, { propId, "magic", value, endRound, });

        -- 魔法效果提升
        propId = PropM.getPropId("magic_effect_style");
        value  = condition["magic_effect"];
        table.insert(props, { propId, "all", value, endRound, });

        return props;
    end,

    desc = function(who, status, condition)
        -- 获取状态描述
        local cfg = CombatStatusM.getStatusInfo(status);
        local desc = cfg.desc;

        -- 魔力提升
        local value  = condition["magic"];
        desc = string.gsub(desc, "{magic}", value);

        -- 魔法效果提升
        value = condition["magic_effect"];
        value = math.modf(value / 10);
        desc = string.gsub(desc, "{rate}", value);

        return desc;
    end,
};
